package com.exp.exception;

import com.exp.result.Result;
import com.exp.result.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//捕获全局异常
//再前端控制层进行统一异常处理

@RestControllerAdvice
public class MyException {

    @ExceptionHandler
    public Result doError(Exception ex){
        return Result.error(StatusCode.ERROR,ex.getMessage());
    }
}
